package com.amigo.online.provider.user.mapper;

import com.amigo.online.common.core.mybatis.MyMapper;
import com.amigo.online.provider.user.model.entity.VipMemberTbl;
import org.apache.ibatis.annotations.Update;

public interface VipMemberTblMapper extends MyMapper<VipMemberTbl> {
    /**
     * 将chat_num-1  如果chat_num小于0就不减（应对chat_num为-1  聊天次数无线的情况）
     * @param id
     * @return
     */
    @Update("UPDATE vip_member_tbl SET chat_num = chat_num - 1 WHERE id = #{id} AND chat_num > 0 LIMIT 1")
    int reduceChatNum(int id);
}